package user

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method("POST")
        url value(consumer(regex("api/users/${number()}/nodeBBUser")), producer('api/users/1/nodeBBUser'))
    }
    response {
        status(201)
        body("""
            {
                "username":"zhang",
                "password":"******",
                "userId":1
            }
            """)
        bodyMatchers {
            jsonPath('$.username', byType())
            jsonPath('$.password', byType())
            jsonPath('$.userId', byRegex(number()))
        }
        headers {
            header('Content-Type': 'application/json;charset=UTF-8')
        }
    }
}
